package com.longjianghuasheng.logistics.business.order.adapter

import android.annotation.SuppressLint
import androidx.core.view.isGone
import coil.load
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.longjianghuasheng.logistics.R
import com.longjianghuasheng.logistics.databinding.ItemLocusBinding
import com.longjianghuasheng.logistics.entity.Way

class LocusAdapter :
    BaseQuickAdapter<Way, BaseDataBindingHolder<ItemLocusBinding>>(R.layout.item_locus) {
    @SuppressLint("SetTextI18n")
    override fun convert(
        holder: BaseDataBindingHolder<ItemLocusBinding>,
        item: Way
    ) {
        holder.dataBinding?.run {

            tvStatus.isGone = item.status.isNullOrBlank()

            tvStatus.text = if (item.status == "1") "进行中" else "已完成"
            tvTitle.text = item.title
            tvType.text = when (item.type) {
                "1" -> "海运"
                "2" -> "陆运"
                "3" -> "铁路运"
                else -> ""
            }

            tvStartTime.text = item.start_time
            tvEndTime.text = item.end_time


        }
    }
}